<template>
  <eTable :tableData="riskTable.rows" :tableCol="riskTable.cols"></eTable>
</template>
<script>
import eTable from "components/table/comTable";

//风险列表table
import { riskListApi } from "api/controlApi";
export default {
  components: {
    eTable,
  },
  props: { assetType: String },
  data() {
    return {
      //风险列表
      riskTable: {
        cols: [
          // { label: "风险ID", prop: "id", width: 80 },
          { label: "风险名称", prop: "riskName", width: 250 },
          { label: "风险类型", prop: "holeType", width: 150 },
          {
            label: "风险状态",
            prop: "status",
            width: 150,
            formatter: (row, column, cellValue, index) => {
              return this.utils.getDicLabel("100700", cellValue);
            },
          },
          {
            label: "风险等级",
            prop: "level",
            formatter: (row, column, cellValue, index) => {
              return this.utils.getDicLabel("level", cellValue);
            },
          },
          { label: "风险描述", prop: "holeDetail" },
          { label: "关联指标", prop: "itemName", width: 200 },
          { label: "关联资产", prop: "domain", width: 250 },
          {
            label: "风险来源",
            prop: "dateType",
            formatter: (row, column, cellValue, index) => {
              return this.utils.getDicLabel("dateType", cellValue);
            },
          },
          { label: "创建时间", prop: "createTimeText", width: 150 },
        ],
        rows: [],
      },
    };
  },
  methods: {
    getRistList() {
      //权限的传upm，其他传空
      riskListApi({ assetType: this.assetType || "", assetId: this.$route.query.id }).then((res) => {
        this.riskTable.rows = res.data;
      });
    },
  },
  mounted() {
    console.log(1111);
    this.getRistList();
  },
};
</script>
